IF NOT EXISTS ( SELECT  1
                FROM    dbo.sysobjects
                WHERE   id = OBJECT_ID(N'[dbo].[ActionLog]')
                        AND OBJECTPROPERTY(id, N'IsUserTable') = 1 ) 
    BEGIN 
        CREATE TABLE [dbo].[ActionLog]
            (
              ID INT IDENTITY
                     PRIMARY KEY
                     NOT NULL ,
              ManchineName NVARCHAR(32) NOT NULL
                                        DEFAULT ( '' ) ,
              UserName NVARCHAR(32) NOT NULL
                                    DEFAULT ( '' ) ,
              AppDomainName NVARCHAR(256) NOT NULL
                                          DEFAULT ( '' ) ,
              Browser NVARCHAR(50) NOT NULL
                                   DEFAULT ( '' ) ,
              IP NVARCHAR(20) NOT NULL
                              DEFAULT ( '' ) ,
              ThreadName NVARCHAR(256) NOT NULL
                                       DEFAULT ( '' ) ,
              MethodName NVARCHAR(512) NOT NULL
                                       DEFAULT ( '' ) ,
              EventLevel TINYINT NOT NULL
                                 DEFAULT ( 0 ) ,
              EventCategory TINYINT NOT NULL
                                    DEFAULT ( 0 ) ,
              MessageInfo NVARCHAR(MAX) NOT NULL
                                        DEFAULT ( '' ) ,
              CreateTime DATETIME NOT NULL
                                  DEFAULT ( GETDATE() ),
            )
    END
INSERT INTO [dbo].[Log](ManchineName,UserName,AppDomainName,Browser,IP,ThreadName,MethodName,EventLevel,EventCategory,MessageInfo,CreateTime) VALUES(@ManchineName,@UserName,@AppDomainName,@Browser,@IP,@ThreadName,@MethodName,@EventLevel,@EventCategory,@MessageInfo,@CreateTime)

